package fr.pascal.intro;

import java.util.Iterator;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import fr.pascal.util.HibernateUtil;

public class App {
	public static void main(String[] args) {
		Session session = HibernateUtil.getSession();
		Transaction tx = session.beginTransaction();
		List<Chat> chats = session.createQuery("from Chat").list();
		for (Iterator<Chat> it = chats.iterator();it.hasNext();) {
			Chat chat = it.next();
			System.out.println(chat.getNom() + " - " + chat.getAge());
		}
		tx.commit();
		session.close();
	}
}
